home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / module-init-tools.postinst < prev    next >
Encoding:
Text File  |  2012-01-22  |  2.2 KB  |  92 lines

  1. #!/bin/sh -e
  2.  
  3. create_etc_modules() {
  4.     if [ ! -e /etc/modules ]; then
  5.     cat <<EOT > /etc/modules
  6. # /etc/modules: kernel modules to load at boot time.
  7. #
  8. # This file contains the names of kernel modules that should be loaded
  9. # at boot time, one per line. Lines beginning with "#" are ignored.
  10. # Parameters can be specified after the module name.
  11.  
  12. EOT
  13.     chmod 644 /etc/modules
  14.     fi
  15. }
  16.  
  17. undivert_gen() {
  18.   DEXT=${3:-modutils}
  19.   dpkg-divert --remove --rename --package module-init-tools \
  20.     --divert $2/$1.$DEXT $2/$1 > /dev/null
  21. }
  22.  
  23. undivert_man() {
  24.   DSECTION=${2:-8}
  25.   for locale in '' fr/; do
  26.     # When a diverted file is removed from a package, old version of dpkg
  27.     # forget to delete it. See #428650 for the gory details.
  28.     rm -f /usr/share/man/${locale}man$DSECTION/$1.modutils.$DSECTION.gz
  29.     dpkg-divert --remove --rename --package module-init-tools --divert \
  30.       /usr/share/man/${locale}man$DSECTION/$1.modutils.$DSECTION.gz \
  31.       /usr/share/man/${locale}man$DSECTION/$1.$DSECTION.gz > /dev/null
  32.   done
  33. }
  34.  
  35. big_modutils_cleanup() {
  36.   undivert_man modules 5
  37.  
  38.   # try hard to remove any old file left around (see #509575 for details)
  39.   for cmd in depmod insmod update-modules modinfo; do
  40.     rm -f /sbin/$cmd.modutils
  41.     undivert_gen $cmd /sbin
  42.     undivert_man $cmd
  43.   done
  44.   for cmd in kallsyms ksyms; do
  45.     rm -f /sbin/$cmd.modutils
  46.     undivert_gen $cmd /sbin
  47.   done
  48.   for cmd in lsmod modprobe rmmod; do
  49.     rm -f /sbin/$cmd.modutils /sbin/$cmd.Lmodutils
  50.     undivert_gen $cmd /sbin Lmodutils
  51.     undivert_man $cmd
  52.   done
  53.  
  54.   # modutils forgets to delete this file on purge
  55.   rm -f /etc/rcS.d/S20modutils
  56. }
  57.  
  58. upgrade_quirks() {
  59.   [ "$2" ] || return 0
  60.  
  61.   dpkg --compare-versions $2 lt 3.3-pre11-4 || return 0
  62.   # finally remove the diversions of modutils
  63.   big_modutils_cleanup
  64.  
  65.   return 0
  66. }
  67.  
  68. case "$1" in
  69.     configure)
  70.     create_etc_modules
  71.  
  72.     upgrade_quirks "$@"
  73.     ;;
  74.  
  75.     abort-upgrade|abort-remove|abort-deconfigure)
  76.     ;;
  77.  
  78.     *)
  79.     echo "$0 called with unknown argument '$1'" >&2
  80.     exit 1
  81.     ;;
  82. esac
  83.  
  84. # Automatically added by dh_installinit
  85. if [ -x "/etc/init.d/module-init-tools" ]; then
  86.     update-rc.d module-init-tools start 20 S . >/dev/null || exit $?
  87. fi
  88. # End automatically added section
  89.  
  90.  
  91. exit 0
  92.